﻿#region 模块信息
// **********************************************************************
// 作    者    (Author):                  
// 创建时间(CreateTime):          
// **********************************************************************
#endregion
using System.IO;
using UnityEditor;
using UnityEngine;

public class AddFileHeadComment : UnityEditor.AssetModificationProcessor
{

    private static void OnWillCreateAsset(string path)
    {
        path = path.Replace(".meta", "");
        if (path.EndsWith(".cs"))
        {
            string allText = File.ReadAllText(path);
            allText = allText.Replace("#AuthorName#", "GUO")
                              .Replace("#CreateTime#", System.DateTime.Now.Year + "/" + System.DateTime.Now.Month
                + "/" + System.DateTime.Now.Day + " " + System.DateTime.Now.Hour + ":"
                + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second);

            File.WriteAllText(path, allText);
        }

    }
}
